<%--
  Created by IntelliJ IDEA.
  User: CY
  Date: 2017/12/25
  Time: 16:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>科室</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title></title>
    <%--<link rel="stylesheet" type="text/css" href="../lib/laydate.css"/>--%>
    <link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../css/news/center.css"/>
    <script type="text/javascript" src="../js/news/jquery-1.9.1.js"></script>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <%--<link rel="stylesheet" type="text/css" href="../lib/laydate.css"/>--%>
    <script src="../js/news/page.js"></script>
    <%--<script src="../lib/laydate.js"></script>--%>
    <script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/layer/layer.js?20201106"></script>
    <script type="text/javascript" src="../js/spirit/qwebchannel.js"></script>
    <%--<script src="../lib/laydate.js"></script>--%>
    <script src="../js/leader/WdatePicker.js"></script>
    <%--<script type="text/javascript" src="../js/echarts.js"></script>--%>
    <style>
        .divSelect{
            margin:10px 0px 0px 20px;
        }
        .table{
            width:95%;
            margin:75px auto 0px;
        }
        .table tr{
            float:left;
        }
        .table td,th{
            display: block;
        }
        .top{
            float:left;
            width:203px;
        }
        .headLeft,.headRight,.left,.right{
            float:left;
            border:1px solid #ccc;
            width:100px;
            height:30px;
            line-height: 30px;
            text-align: center;
            margin:-1px 0px 0px -1px;
            font-size:14px;
        }
        .headLeft,.headRight{
            font-weight: bold;
        }
        .list li:nth-child(odd) .left,.list li:nth-child(odd) .right{
            background:#F6F7F9;
        }
        .laydate_table ,#laydate_MM,#laydate_today{
            display: none!important;
        }
        #laydate_hms{
            display: none !important;
        }

    </style>
</head>
<body>
    <div class="container" style="overflow: hidden">
        <div class="divSelect">
            <input type="text" style="width:150px;height: 28px;border-radius: 3px;" id="year" value="2018" class="Wdate" id="year"   onclick="WdatePicker({onpicked:function(dq){init();},dateFmt:'yyyy'})">
            <%--<select id="year">--%>
                <%--<option value="2017" selected="selected">2017</option>--%>
                <%--<option value="2016">2016</option>--%>
                <%--<option value="2015">2015</option>--%>
                <%--<option value="2014">2014</option>--%>
                <%--<option value="2013">2013</option>--%>
                <%--<option value="2012">2012</option>--%>
                <%--<option value="2011">2011</option>--%>
                <%--<option value="2010">2010</option>--%>
            <%--</select>--%>
            <span style="font-size:18px;font-weight:bold;float:right;margin-right:20px;color:#2F5C8F">合计:<span class="num"></span></span>
        </div>
        <div class="table">

        </div>
    </div>
    <script>
        function objdata(obj) {
            if(obj==undefined){
                return new Object();
            }else {
                return obj;
            }
        }
        $('#year').change(function(){
            init();
        })

        function init(){
            $('.table').empty();
            $.ajax({
                url:'/infomation/getDeptInfo',
                type:'get',
                data:{year:$('#year').val()},
                dataType:'json',
                success:function(res){
                    var data=res.obj;
                    if(data.length==0){
                        $.layerMsg({content:'暂无数据',icon:6})
                    }
                    $('.num').html(res.totleNum)
                    var str=$('<div class="top">' +
                        '                <div class="headLeft" style="color:#2F5C8F">科室</div>' +
                        '                <div class="headRight" style="color:#2F5C8F">报送信息量</div>' +
                        '                <ul class="list">' +
                        '                </ul>' +
                        '            </div>');
                    var num=data.length;
//                    num=Math.ceil(num);
                    var str2="";
//                var numm=num*15;
                    for(var i=0;i<num;i++){
                        if(num==1){
                            str2 = ' <li>' +
                                '                        <div class="left">'+function(){
                                    if(objdata(data[i]).deptTypeName==undefined){
                                        return '';
                                    }else{
                                        return objdata(data[i]).deptTypeName;
                                    }
                                }()+'</div>' +
                                '                        <div class="right">'+function(){
                                    if(objdata(data[i]).deptTypeCount==undefined){
                                        return '';
                                    }else{
                                        return objdata(data[i]).deptTypeCount;
                                    }
                                }()+'</div>' +
                                '                    </li>';
                            str.find('.list').append(str2);
                            $('.table').append(str[0].outerHTML);
                        }else{
                            if(i%15!=0){
                                str2 = ' <li>' +
                                    '                        <div class="left">'+function(){
                                        if(objdata(data[i]).deptTypeName==undefined){
                                            return '';
                                        }else{
                                            return objdata(data[i]).deptTypeName;
                                        }
                                    }()+'</div>' +
                                    '                        <div class="right">'+function(){
                                        if(objdata(data[i]).deptTypeCount==undefined){
                                            return '';
                                        }else{
                                            return objdata(data[i]).deptTypeCount;
                                        }
                                    }()+'</div>' +
                                    '                    </li>';
                                str.find('.list').append(str2);
                                if(i==(num-1)){
                                     $('.table').append(str[0].outerHTML);
                                }
//                                $('.table').append(str[0].outerHTML);
//                                $('.table').append(str);
                            }else{
                                if(i==0){
                                    str2 = ' <li>' +
                                        '                        <div class="left">'+function(){
                                            if(objdata(data[i]).deptTypeName==undefined){
                                                return '';
                                            }else{
                                                return objdata(data[i]).deptTypeName;
                                            }
                                        }()+'</div>' +
                                        '                        <div class="right">'+function(){
                                            if(objdata(data[i]).deptTypeCount==undefined){
                                                return '';
                                            }else{
                                                return objdata(data[i]).deptTypeCount;
                                            }
                                        }()+'</div>' +
                                        '                    </li>';
                                    str.find('.list').append(str2);
                                }else {
//                                    console.log(str)
                                    $('.table').append(str[0].outerHTML);
                                    str=$('<div class="top">' +
                                        '                <div class="headLeft">科室</div>' +
                                        '                <div class="headRight">报送信息量</div>' +
                                        '                <ul class="list">' +
                                        '                </ul>' +
                                        '            </div>');
                                    str2= ' <li>' +
                                        '                        <div class="left">' + function () {
                                            if (objdata(data[i]).deptTypeName == undefined) {
                                                return '';
                                            } else {
                                                return objdata(data[i]).deptTypeName;
                                            }
                                        }() + '</div>' +
                                        '                        <div class="right">' + function () {
                                            if (objdata(data[i]).deptTypeCount == undefined) {
                                                return '';
                                            } else {
                                                return objdata(data[i]).deptTypeCount;
                                            }
                                        }() + '</div>' +
                                        '                    </li>';
                                    str.find('.list').html(str2);

                                }
                            }

                        }
                    }
                }
            })
        }
        init()

//        $('.list li:even').css('background','#F6F7F9')
    </script>
</body>
</html>
